package cn.com.dhc.danlu.util;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;

import cn.com.dhc.danlu.activity.LoginActivity;
import cn.com.dhc.danlu.activity.MainMenuActivity;
import cn.com.dhc.danlu.activity.delivery.DeliveryDetailActivity;

/**
 * Activity共通方法
 *
 * @author MuWei
 * @version 1.00 2015/02/06 新建
 */
public class ActivityUtils {
    /**
     * 跳转至首页画面
     *
     * @param context Context
     */
    public static void startMainMenuActivity(Context context) {
        Intent intent = new Intent();
        intent.setClass(context, MainMenuActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
        context.startActivity(intent);
    }

    /**
     * 跳转至登录画面
     *
     * @param context Context
     */
    @SuppressLint("InlinedApi")
    public static void startLoginActivity(Context context) {
        Intent intent = new Intent();
        intent.setClass(context, LoginActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(intent);
    }

    /**
     * 跳转至订单详细画面
     *
     * @param context Context
     * @param orderId 订单编号
     */
    public static void startDeliveryDetailActivity(Context context, String orderId) {
        Intent intent = new Intent();
        intent.putExtra(CommonConst.IntentKey.ORDER_ID, orderId);
        intent.setClass(context, DeliveryDetailActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
        context.startActivity(intent);
    }
}